home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / PCCardTuples.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-23  |  12.9 KB  |  407 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        PCCardTuples.h
  3.  
  4.      Contains:    List of PCMCIA tuple types and definitions of tuple contents.
  5.  
  6.      Version:    Technology: PCMCIA Software 2.0
  7.                 Package:    Universal Interfaces 2.1.1 in “MPW Latest” on ETO #19
  8.   
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.   
  18. */
  19.  
  20. #ifndef __PCCARDTUPLES__
  21. #define __PCCARDTUPLES__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. #if PRAGMA_ALIGN_SUPPORTED
  34. #pragma options align=mac68k
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT_SUPPORTED
  38. #pragma import on
  39. #endif
  40.  
  41.  
  42. enum {
  43.     MAX_TUPLE_SIZE                = 256
  44. };
  45.  
  46. /*————————————————————————————————————————————————————————————————————————
  47.     Defines for Tuple codes
  48. ————————————————————————————————————————————————————————————————————————*/
  49. enum {
  50.     CISTPL_NULL                    = 0x00,
  51.     CISTPL_DEVICE                = 0x01,
  52.     CISTPL_LONGLINK_MFC            = 0x06,
  53.     CISTPL_CHECKSUM                = 0x10,
  54.     CISTPL_LONGLINK_A            = 0x11,
  55.     CISTPL_LONGLINK_C            = 0x12,
  56.     CISTPL_LINKTARGET            = 0x13,
  57.     CISTPL_NO_LINK                = 0x14,
  58.     CISTPL_VERS_1                = 0x15,
  59.     CISTPL_ALTSTR                = 0x16,
  60.     CISTPL_DEVICE_A                = 0x17,
  61.     CISTPL_JEDEC_C                = 0x18,
  62.     CISTPL_JEDEC_A                = 0x19,
  63.     CISTPL_CONFIG                = 0x1A,
  64.     CISTPL_CFTABLE_ENTRY        = 0x1B,
  65.     CISTPL_DEVICE_OC            = 0x1C,
  66.     CISTPL_DEVICE_OA            = 0x1D,
  67.     CISTPL_DEVICE_GEO            = 0x1E,
  68.     CISTPL_DEVICE_GEO_A            = 0x1F,
  69.     CISTPL_MANFID                = 0x20,
  70.     CISTPL_FUNCID                = 0x21,
  71.     CISTPL_FUNCE                = 0x22,
  72.     CISTPL_SWIL                    = 0x23,
  73.     CISTPL_VERS_2                = 0x40,
  74.     CISTPL_FORMAT                = 0x41,
  75.     CISTPL_GEOMETRY                = 0x42,
  76.     CISTPL_BYTEORDER            = 0x43,
  77.     CISTPL_DATE                    = 0x44,
  78.     CISTPL_BATTERY                = 0x45,
  79.     CISTPL_ORG                    = 0x46,
  80.     CISTPL_VENDOR                = 0xFE,
  81.     CISTPL_END                    = 0xFF
  82. };
  83.  
  84. /*————————————————————————————————————————————————————————————————————————
  85.     Tuple Data Block Definitions
  86. ————————————————————————————————————————————————————————————————————————*/
  87. /*------------    Device Information Tuple (01H, 17H)    -----------                            */
  88. typedef struct DeviceIDTuple DeviceIDTuple;
  89.  
  90. struct DeviceIDTuple {
  91.     Byte                            TPLDEV_TYPE_WPS_SPEED;        /* Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0*/
  92.     Byte                            deviceData[MAX_TUPLE_SIZE - 3];
  93. };
  94.  
  95. enum {
  96.     TPLDEV_TYPE_MASK            = 0xF0,                            /* device type mask for TPLDEV_TYPE_WPS_SPEED*/
  97.     TPLDEV_TYPE_EXTENDED        = 0xE0,                            /* device type value for extended type*/
  98.     TPLDEV_WPS_MASK                = 0x08,                            /* write-protect switch mask for TPLDEV_TYPE_WPS_SPEED*/
  99.     TPLDEV_SPEED_MASK            = 0x07,                            /* device speed mask for TPLDEV_TYPE_WPS_SPEED*/
  100.     TPLDEV_DSPEED_NULL            = 0x00,                            /* speed for null device type*/
  101.     TPLDEV_DSPEED_250NS            = 0x01,                            /* 250ns card access time*/
  102.     TPLDEV_DSPEED_200NS            = 0x02,                            /* 200ns card access time*/
  103.     TPLDEV_DSPEED_150NS            = 0x03,                            /* 150ns card access time*/
  104.     TPLDEV_DSPEED_100NS            = 0x04,                            /* 100ns card access time*/
  105.     TPLDEV_EXTENDED_SPEED        = 0x07,                            /* device speed value for extended speed*/
  106.     TPLDEV_SPEED_EXPONENT        = 0x07,                            /* extended byte exponent mask*/
  107.     TPLDEV_SPEED_MANTISSA        = 0x78,                            /* extended byte mantissa mask*/
  108.     TPLDEV_SPEED_EXTENDED_MASK    = 0x80                            /* bit set if more extended speed data follows*/
  109. };
  110.  
  111. /*    device ID types*/
  112. enum {
  113.     DTYPE_NULL,
  114.     DTYPE_ROM,
  115.     DTYPE_OTPROM,
  116.     DTYPE_EPROM,
  117.     DTYPE_EEPROM,
  118.     DTYPE_FLASH,
  119.     DTYPE_SRAM,
  120.     DTYPE_DRAM,
  121.     DTYPE_FUNCSPEC                = 0x0D,
  122.     DTYPE_EXTEND
  123. };
  124.  
  125. /*---------------    Checksum Control Tuple (10H)    ---------------                            */
  126. typedef struct ChecksumControlTuple ChecksumControlTuple;
  127.  
  128. struct ChecksumControlTuple {
  129.     short                            TPLCKS_ADDR;                /* offset to region to be checksummed, LSB first*/
  130.     short                            TPLCKS_LEN;                    /* length of region to be checksummed, LSB first*/
  131.     char                            TPLCKS_CS;                    /* checksum of the region*/
  132.     Byte                            reserved;                    /* padding*/
  133. };
  134. /*----------------    Long Link Multi-Function Tuple (06H)    ------                    */
  135. typedef struct LongLinkMFCTuple LongLinkMFCTuple;
  136.  
  137. struct LongLinkMFCTuple {
  138.     UInt8                            TPLMFC_NUM;                    /* Number of sets of config registers for individual functions*/
  139.     UInt8                            TPLMFC_TAS1;                /* CIS target address space for first function (00 = Attr, 01 = Common)*/
  140.     UInt32                            TPLMFC_ADDR1;                /* Target address of first CIS, unsigned long, lsb first*/
  141.     UInt8                            TPLMFC_TAS2;                /* CIS target address space for second function (00 = Attr, 01 = Common)*/
  142.     UInt32                            TPLMFC_ADDR2;                /* Target address of second CIS, unsigned long, lsb first*/
  143. /* the following fields are of undetermined length and should be calculated at runtime*/
  144. /* */
  145. /* UInt8        TPLMFC_TASn;*/
  146. /* UInt32        TPLMFC_ADDRn;*/
  147. };
  148. /*----------------    Long Link Tuple (11H, 12H)    ----------------                            */
  149. typedef struct LongLinkTuple LongLinkTuple;
  150.  
  151. struct LongLinkTuple {
  152.     UInt32                            TPLL_ADDR;                    /* target address, LSB first*/
  153. };
  154. /*-----------------    Link Target Tuple (13H)    ------------------                            */
  155. typedef struct LinkTargetTuple LinkTargetTuple;
  156.  
  157. struct LinkTargetTuple {
  158.     Byte                            TPLL_TAG[3];                /* tag: should be 'C', 'I', 'S'*/
  159. };
  160. /*----------------    Level 1 Version Tuple (15H)    ---------------                            */
  161. typedef struct Level1VersionTuple Level1VersionTuple;
  162.  
  163. struct Level1VersionTuple {
  164.     Byte                            TPLLV1_MAJOR;                /* major version number (0x04)*/
  165.     Byte                            TPLLV1_MINOR;                /* minor version number (0x01 for release 2.0 and 2.01)*/
  166.     Byte                            TPLLV1_INFO[1];                /* product information string, zero-terminated*/
  167. };
  168. /*-------------    JEDEC Identifier Tuple (18H, 19H)    ------------                            */
  169. typedef struct JEDECDeviceInfo JEDECDeviceInfo;
  170.  
  171. struct JEDECDeviceInfo {
  172.     Byte                            manufacturerID;
  173.     Byte                            manufacturerInfo;
  174. };
  175. typedef struct JEDECIdentifierTuple JEDECIdentifierTuple;
  176.  
  177. struct JEDECIdentifierTuple {
  178.     JEDECDeviceInfo                    device[1];
  179. };
  180. /*---------    Configuration Tuple (1AH)    ----------                            */
  181. typedef struct ConfigTuple ConfigTuple;
  182.  
  183. struct ConfigTuple {
  184.     Byte                            TPCC_SZ;                    /* size of fields byte*/
  185.     Byte                            TPCC_LAST;                    /* index number of last config entry*/
  186.     Byte                            TPCC_RADR;                    /* config reg's base addr in reg. space*/
  187.     Byte                            reserved;                    /* padding*/
  188. /* the following fields are of undetermined length and should be calculated at runtime*/
  189. /*UInt32            TPCC_RMSK;*/
  190. /*UInt32            TPCC_RSVD;*/
  191. /*UInt32            TPCC_SBTPL;*/
  192. };
  193. /*    TPCC_RADR field definitions*/
  194.  
  195. enum {
  196.     TPCC_RASZ                    = 0x03,                            /* bits 1-0*/
  197.     TPCC_RMSZ                    = 0x3C,                            /* bits 5-2*/
  198.     TPCC_RFSZ                    = 0xC0                            /* bits 7-6*/
  199. };
  200.  
  201. /*---------    Device Geometry Tuple (1EH, 1FH)    ----------*/
  202. typedef struct DeviceGeometry DeviceGeometry;
  203.  
  204. struct DeviceGeometry {
  205.     UInt8                            DGTPL_BUS;                    /* system bus width = 2^(n-1), n>0*/
  206.     UInt8                            DGTPL_EBS;                    /* erase block size = 2^(n-1), n>0*/
  207.     UInt8                            DGTPL_RBS;                    /* read block size = 2^(n-1), n>0*/
  208.     UInt8                            DGTPL_WBS;                    /* write block size = 2^(n-1), n>0*/
  209.     UInt8                            DGTPL_PART;                    /* partitioning size = 2^(n-1), n>0*/
  210.     UInt8                            DGTPL_HWIL;                    /* hardware interleave = 2^(n-1), n>0*/
  211. };
  212. typedef struct DeviceGeometryTuple DeviceGeometryTuple;
  213.  
  214. struct DeviceGeometryTuple {
  215.     DeviceGeometry                    device[42];
  216. };
  217. /*---------    Manufacturer Identification Tuple (20H)    ----------                            */
  218. typedef struct ManufIDTuple ManufIDTuple;
  219.  
  220. struct ManufIDTuple {
  221.     short                            TPLMID_MANF;                /* PCMCIA PC Card manufacturer code*/
  222.     short                            TPLMID_CARD;                /* manufacturer information (part number and/or revision)*/
  223. };
  224. /*-----------    Function Identification Tuple (21H)    ------------                            */
  225. typedef struct FunctionIDTuple FunctionIDTuple;
  226.  
  227. struct FunctionIDTuple {
  228.     Byte                            TPLFID_FUNCTION;            /* PC card function code*/
  229.     Byte                            TPLFID_SYSINIT;                /* system initialization bit mask*/
  230. };
  231. /*    function codes*/
  232.  
  233. enum {
  234.     TPLFID_MultiFunction,
  235.     TPLFID_Memory,
  236.     TPLFID_SerialPort,
  237.     TPLFID_ParallelPort,
  238.     TPLFID_FixedDisk,
  239.     TPLFID_VideoAdaptor,
  240.     TPLFID_NetworkLANAdaptor,
  241.     TPLFID_AIMS
  242. };
  243.  
  244. /*------------    Software Interleave Tuple (23H)    ---------------                            */
  245. typedef struct SoftwareInterleaveTuple SoftwareInterleaveTuple;
  246.  
  247. struct SoftwareInterleaveTuple {
  248.     char                            TPLSWIL_INTRLV;                /* software interleave*/
  249. };
  250. /*-------    Level 2 Version and Information Tuple (40H)    --------                            */
  251. typedef struct Level2VersionTuple Level2VersionTuple;
  252.  
  253. struct Level2VersionTuple {
  254.     Byte                            TPLLV2_VERS;                /* structure version (0x00)*/
  255.     Byte                            TPLLV2_COMPLY;                /* level of compliance with the standard (0x00)*/
  256.     UInt16                            TPLLV2_DINDEX;                /* byte address of first data byte in card, LSB first*/
  257.     Byte                            TPLLV2_RSV6;                /* reserved, must be zero*/
  258.     Byte                            TPLLV2_RSV7;                /* reserved, must be zero*/
  259.     Byte                            TPLLV2_VSPEC8;                /* vendor specific byte*/
  260.     Byte                            TPLLV2_VSPEC9;                /* vendor specific byte*/
  261.     char                            TPLLV2_NHDR;                /* number of copies of CIS present on this device*/
  262.     char                            TPLLV2_OEM[1];                /* vendor of software that formatted card, zero-terminated*/
  263.     char                            TPLLV2_INFO[1];                /* informational message about the card, zero-terminated*/
  264.     Byte                            reserved;                    /* padding*/
  265. };
  266. /*--------------------    Format Tuple (41H)    --------------------                            */
  267. /* additional information for disk type:*/
  268. typedef struct FormatDiskTuple FormatDiskTuple;
  269.  
  270. struct FormatDiskTuple {
  271.     UInt16                            TPLFMT_BKSZ;                /*    block size, or zero if unblocked format*/
  272.     UInt32                            TPLFMT_NBLOCKS;                /*    number of data blocks in this partition*/
  273.     UInt32                            TPLFMT_EDCLOC;                /*    location of error detection code, or zero if interleaved*/
  274. };
  275. /* additional information for disk type:*/
  276. typedef struct FormatMemTuple FormatMemTuple;
  277.  
  278. struct FormatMemTuple {
  279.     Byte                            TPLFMT_FLAGS;                /*    various flags*/
  280.     Byte                            TPLFMT_RESERVED;            /*    reserved, set to zero*/
  281.     UInt32                            TPLFMT_ADDRESS;                /*    physical location at which this memory partion must be mapped*/
  282.     UInt32                            TPLFMT_EDCLOC;                /*    location of error detection code, or zero if interleaved*/
  283. };
  284. typedef struct FormatTuple FormatTuple;
  285.  
  286. struct FormatTuple {
  287.     char                            TPLFMT_TYPE;                /* format type code*/
  288.     char                            TPLFMT_EDC;                    /* error detection method and length of error detection code*/
  289.     long                            TPLFMT_OFFSET;                /* offset to first data byte in this partition*/
  290.     long                            TPLFMT_NBYTES;                /* number of data bytes in this partition*/
  291.     union {
  292.         FormatDiskTuple                    TPLFMT_DISK;
  293.         FormatMemTuple                    TPLFMT_MEM;
  294.     }                                u;
  295. };
  296. /*    format types*/
  297.  
  298. enum {
  299.     TPLFMTTYPE_DISK,
  300.     TPLFMTTYPE_MEM,
  301.     TPLFMTTYPE_VS                = 0x80
  302. };
  303.  
  304. /*    error detection types*/
  305. enum {
  306.     TPLFMTEDC_NONE,
  307.     TPLFMTEDC_CKSUM,
  308.     TPLFMTEDC_CRC,
  309.     TPLFMTEDC_PCC,
  310.     TPLFMTEDC_VS                = 8
  311. };
  312.  
  313. /*    bits in TPLFMT_FLAGS*/
  314. enum {
  315.     TPLFMTFLAGS_ADDR,
  316.     TPLFMTFLAGS_AUTO
  317. };
  318.  
  319. /*------------------    Geometry Tuple (42H)    --------------------                            */
  320. typedef struct GeometryTuple GeometryTuple;
  321.  
  322. struct GeometryTuple {
  323.     char                            TPLGEO_SPT;                    /* number of sectors per track*/
  324.     char                            TPLGEO_TPC;                    /* number of tracks per cylinder*/
  325.     short                            TPLGEO_NCYL;                /* number of cylinders, total*/
  326. };
  327. /*-----------------    Byte-Order Tuple (43H)    -------------------                            */
  328. typedef struct ByteOrderTuple ByteOrderTuple;
  329.  
  330. struct ByteOrderTuple {
  331.     char                            TPLBYTE_ORDER;                /* byte order code*/
  332.     char                            TPLBYTE_MAP;                /* byte mapping code*/
  333. };
  334. /*    byte order codes*/
  335.  
  336. enum {
  337.     TYPBYTEORD_LOW,
  338.     TYPBYTEORD_HIGH,
  339.     TYPBYTEORD_VS                = 0x80
  340. };
  341.  
  342. /*    byte mapping codes*/
  343. enum {
  344.     TYPBYTEMAP_LOW,
  345.     TYPBYTEMAP_HIGH,
  346.     TYPBYTEMAP_VS                = 0x80
  347. };
  348.  
  349. /*----------    Card Initialization Date Tuple (44H)    ------------                            */
  350. typedef struct CardInitDateTuple CardInitDateTuple;
  351.  
  352. struct CardInitDateTuple {
  353.     UInt16                            TPLDATE_TIME;                /* hours, minutes, seconds*/
  354.     UInt16                            TPLDATE_DAY;                /* year, month, day*/
  355. };
  356. /*----------    Battery-Replacement Date Tuple (45H)    ------------                            */
  357. typedef struct BatteryReplaceDateTuple BatteryReplaceDateTuple;
  358.  
  359. struct BatteryReplaceDateTuple {
  360.     UInt16                            TPLBATT_RDAY;                /* last replacement date (year, month, day)*/
  361.     UInt16                            TPLBATT_XDAY;                /* battery expiration date (year, month, day)*/
  362. };
  363. /*----------------------    General Tuple    -----------------------                            */
  364. typedef union TupleBody TupleBody;
  365.  
  366. union TupleBody {
  367.     DeviceIDTuple                    deviceID;
  368.     ChecksumControlTuple            checksum;
  369.     LongLinkTuple                    link;
  370.     LinkTargetTuple                    target;
  371.     Level1VersionTuple                level1;
  372.     JEDECIdentifierTuple            jedecID;
  373.     ConfigTuple                        config;
  374.     DeviceGeometryTuple                devGeo;
  375.     ManufIDTuple                    manufID;
  376.     FunctionIDTuple                    funcID;
  377.     SoftwareInterleaveTuple            swil;
  378.     Level2VersionTuple                level2;
  379.     FormatTuple                        format;
  380.     GeometryTuple                    geometry;
  381.     ByteOrderTuple                    order;
  382.     CardInitDateTuple                initDate;
  383.     BatteryReplaceDateTuple            battDate;
  384.     Byte                            tupleData[MAX_TUPLE_SIZE - 2];
  385. };
  386. typedef struct Tuple Tuple;
  387.  
  388. struct Tuple {
  389.     Byte                            TPL_CODE;
  390.     Byte                            TPL_LINK;
  391.     TupleBody                        TPL_BODY;
  392. };
  393.  
  394. #if PRAGMA_IMPORT_SUPPORTED
  395. #pragma import off
  396. #endif
  397.  
  398. #if PRAGMA_ALIGN_SUPPORTED
  399. #pragma options align=reset
  400. #endif
  401.  
  402. #ifdef __cplusplus
  403. }
  404. #endif
  405.  
  406. #endif /* __PCCARDTUPLES__ */
  407.